/*获取微信code*/
export const getAuthCode = (provider, cb) => {
  uni.login({
    provider: provider,
    scopes: 'auth_user',
    success: function(loginRes) {
      cb(loginRes)
    }
  })
}
export const getUserInfo = (cb, desc = '') => {
  // #ifdef MP-ALIPAY
  my.getAuthUserInfo({
    success: (userInfo) => {
      cb(userInfo)
    },
    fail: (error) => {
      console.error('getAuthUserInfo', error);
    }
  });
  // #endif
  // #ifdef MP-WEIXIN
  uni.getUserProfile({
    desc: desc,
    success(res) {
      if (res) {
        cb(res.userInfo)
      } else {
        // console.log('登录失败！' + res.errMsg)
      }
    }
  })
  // #endif
}
